seo

Google Analytics Tracking Code Basics and Time Saving Plugins

Google News The analytics ninja is not dead, but with Avinash talking more about SEO analytics and SEOs like Rand talking more about web analytics, 2010 has brought with it increased cross-pollination between analytics experts and SEOs.

This blog post is for the analytics driven, SEO savvy, search samurai looking to implement tracking code best practices and take advantage of some useful Google Analytics plugins.

The focus of this post is on Google Analytics, but many of the concepts are also applicable more generally, no matter what web analytics platform you’re using.

Tracking Code Basics

Asynchronous Tracking Code – Even before the asynchronous tracking code was rolled out, I was a believer in putting the GA tracking code in the header, rather than before the closing body tag, which is where Google recommends placing the tracking code. With the announcement of asynchronous tracking code, which loads in conjunction with the page as opposed to sequentially, however, you can now have your cake and eat it too. You can get the benefit of your data not being compromised by slow page load times and also keep from getting push back from the developer that implements your tracking codes.

Expanding Goal Limitations – Without setting up goals, your GA account is a glorified hit counter. So it’s imperative that you set up goal or eCommerce tracking (if not both). When setting up your GA goals in your analytics settings, you can either use the expanded goals, which allow you to track up to 20 different URLs or engagement metrics per profile. It’s important to realize, however, that you can also set your goals up so you can track hundreds or even thousands of goals. All you have to do is set up a logical hierarchy where the root of your goal URLs trigger your goal events. For us at SEOmoz, this might mean we have a tool run goal event triggered with /goal/tool-run – yet we also have the added granularity down to the individual tool level should we ever want to see which tools are being run the most or to segment traffic based on visitors who ran a particular tool.

eCommerce Tracking – Justin Cutroni did a great job with his series of blog posts that walk through how eCommerce tracking works, installing & setting up eCommerce tracking, explaining why everyone should use eCommerce tracking, & tracking lead gen forms. In addition to eCommerce tracking, not to be forgotten is using SetVar or a custom variable to segment repeat or premium buyers. For example, say your site gets 5 sales from keyword #1 and 5 sales from keyword #2. If sales for keyword #1 are each $800 and sales from keyword #2 are $10 each, you’re going to want to segment that traffic and make on-page optimizations by looking at the on-site behavior of your premium buyers who converted on keyword #1, rather than from keyword #2. Β 

Custom Variables for Registered & Non-Registered – One of the most powerful aspects of GA is the ability to set custom variable. Custom variables can be set at any of three levels (visitor, session, & page). The Google Analytics help documentation is particularly great, but EpikOne also has a worthwhile description on how custom variables work. The most powerful of these is the visitor level custom variable which allows you to cookie a visitor across multiple sessions. At SEOmoz, we use this to track three different member types: free members, PRO members, & canceled members. We also use custom variables to cookie at the session level.

Β 
Campaign Tagging & SetAllowAnchor – From widgets to newsletters to signature links in personal e-mails, campaign links should be tagged using the GA URL builder, which gives you tracking parameters that includes multiple, including required _utm values for source, medium, & campaign. In action this looks something like this:

https://moz.com/?utm_source=newsletter&utm_medium=email&utm_campaign=march-6-2010

When tagging your campaigns be aware that by default GA will only recognize tracking parameters if the string is kicked off by a question mark, which from an SEO standpoint can lead to diffusion of link juice and duplicate content issues. To avoid these issues, we you can kick off campaign parameters with the hash tag and modify your GA tracking code using the SetAllowAnchor attribute, so GA recognizes the hash tag as way to kick off a campaign tracking URLs. To do this, add — pageTracker._setAllowAnchor(true); — to your main GA tracking code between the var pageTracker and pageTracker attributes. Or, for additional documentation, read LunaMetrics’ blog post on using SetAllowAnchor, but the code should look something like this:

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button